package com.tcmj.dining.service.impl;

import java.util.List;
import com.tcmj.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tcmj.dining.mapper.TzVagetablesMapper;
import com.tcmj.dining.domain.TzVagetables;
import com.tcmj.dining.service.ITzVagetablesService;
import com.tcmj.common.core.text.Convert;

/**
 * 菜品Service业务层处理
 * 
 * @author tcmj
 * @date 2020-05-17
 */
@Service
public class TzVagetablesServiceImpl implements ITzVagetablesService 
{
    @Autowired
    private TzVagetablesMapper tzVagetablesMapper;

    /**
     * 查询菜品
     * 
     * @param vagetablesId 菜品ID
     * @return 菜品
     */
    @Override
    public TzVagetables selectTzVagetablesById(Long vagetablesId)
    {
        return tzVagetablesMapper.selectTzVagetablesById(vagetablesId);
    }

    /**
     * 查询菜品列表
     * 
     * @param tzVagetables 菜品
     * @return 菜品
     */
    @Override
    public List<TzVagetables> selectTzVagetablesList(TzVagetables tzVagetables)
    {
        return tzVagetablesMapper.selectTzVagetablesList(tzVagetables);
    }

    /**
     * 新增菜品
     * 
     * @param tzVagetables 菜品
     * @return 结果
     */
    @Override
    public int insertTzVagetables(TzVagetables tzVagetables)
    {
        tzVagetables.setCreateTime(DateUtils.getNowDate());
        return tzVagetablesMapper.insertTzVagetables(tzVagetables);
    }

    /**
     * 修改菜品
     * 
     * @param tzVagetables 菜品
     * @return 结果
     */
    @Override
    public int updateTzVagetables(TzVagetables tzVagetables)
    {
        tzVagetables.setUpdateTime(DateUtils.getNowDate());
        return tzVagetablesMapper.updateTzVagetables(tzVagetables);
    }

    /**
     * 删除菜品对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTzVagetablesByIds(String ids)
    {
        return tzVagetablesMapper.deleteTzVagetablesByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除菜品信息
     * 
     * @param vagetablesId 菜品ID
     * @return 结果
     */
    @Override
    public int deleteTzVagetablesById(Long vagetablesId)
    {
        return tzVagetablesMapper.deleteTzVagetablesById(vagetablesId);
    }

	@Override
	public int selectVagetablesCount() {
		// TODO Auto-generated method stub
		return tzVagetablesMapper.selectVagetablesCount();
	}
}
